﻿using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using QuickUIT.Controls;

namespace QuickUIT.Tests
{
    [TestClass]
    public class UIImageTests
    {
        private BaseState _baseState;

        [TestInitialize]
        public void TestSetup()
        {
            _baseState = new BaseState(TestUtilities.GetTestApplicationFileName(), "@Name='QuickUIT Test Application'");
            _baseState.Execute();
        }

        [TestMethod]
        public void ShouldGetImage()
        {
            var window = new UIWindow("@Name='QuickUIT Test Application'");
            UIImage image = window.UIImage("@AutomationId='image1'"); 
            Assert.IsNotNull(image);

            image = window.UIImage(); 
            Assert.IsNotNull(image);
            Assert.AreEqual("image1", image.AutomationId);
        }

        [TestMethod]
        public void ShouldGetAllImages()
        {
            var window = new UIWindow("@Name='QuickUIT Test Application'");
            List<UIImage> images = window.UIImages(); 
            Assert.AreEqual(1, images.Count);
            Assert.AreEqual("image1", images[0].AutomationId);
        }

        [TestMethod]
        public void ShouldGetColumn()
        {
            var window = new UIWindow("@Name='QuickUIT Test Application'");
            UIImage image = window.UIImage("@AutomationId='image1'"); 
            Assert.AreEqual(-1, image.Column);
        }

        [TestMethod]
        public void ShouldGetColumnSpan()
        {
            var window = new UIWindow("@Name='QuickUIT Test Application'");
            UIImage image = window.UIImage("@AutomationId='image1'");
            Assert.AreEqual(-1, image.ColumnSpan);
        }

        [TestMethod]
        public void ShouldGetRow()
        {
            var window = new UIWindow("@Name='QuickUIT Test Application'");
            UIImage image = window.UIImage("@AutomationId='image1'");
            Assert.AreEqual(-1, image.Row);
        }

        [TestMethod]
        public void ShouldGetRowSpan()
        {
            var window = new UIWindow("@Name='QuickUIT Test Application'");
            UIImage image = window.UIImage("@AutomationId='image1'");
            Assert.AreEqual(-1, image.RowSpan);
        }

        [TestCleanup]
        public void TestTeardown()
        {
            _baseState.Cleanup();
        }
    }
}